import request from '../utils/request';

// 获取购物车商品列表
export const getCartItemsApi = () => {
    return request.get('/api/cart/');
};

// 添加商品到购物车
export const addToCartApi = (productId, quantity) => {
    return request.post('/api/cart/', {
        productId,
        quantity
    });
};

// 从购物车移除商品
export const removeFromCartApi = (productId) => {
    return request.delete(`/api/cart/${productId}`); // 将 :productId 替换为实际的 productId
};

// 更新购物车商品数量
export const updateCartItemApi = (productId, quantity) => {
    return request.put(`/api/cart/${productId}`, { // 将 :productId 替换为实际的 productId
        quantity
    });
};